package org.chen.controller;

import org.chen.domain.dto.UpdatePasswordDTO;
import org.chen.domain.dto.UserQueryDTO;
import org.chen.domain.response.PageResult;
import org.chen.domain.response.Result;
import org.chen.domain.vo.UserVO;
import org.chen.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserServiceImpl userService;
    
    @GetMapping("/info")
    public Result<UserVO> getUserInfo() {
        return Result.success(userService.getCurrentUserInfo());
    }
    
    @PutMapping("/password")
    public Result<Void> updatePassword(@RequestBody UpdatePasswordDTO dto) {
        userService.updatePassword(dto);
        return Result.success();
    }
}